package cn.lingyangwl.agile.pay.pay.controller.payorder;

import cn.lingyangwl.agile.pay.common.annotation.PayCheck;
import cn.lingyangwl.agile.pay.pay.model.rqrs.payorder.ClosePayOrderExtRS;
import cn.lingyangwl.framework.core.response.Resp;
import cn.lingyangwl.agile.common.security.annotation.Anonymous;
import cn.lingyangwl.agile.pay.model.rqrs.pay.payorder.ClosePayOrderRQ;
import cn.lingyangwl.agile.pay.validation.PaySignGroup;
import cn.lingyangwl.agile.pay.pay.process.payorder.CloseOrderProcess;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 关闭订单 controller
 *
 * @author shenguangyang
 */
@Slf4j
@RestController
@Anonymous
public class CloseOrderController {

    @Resource
    private CloseOrderProcess closeOrderProcess;

    /**
     * 关闭订单
     */
    @PostMapping("/pay/closeOrder")
    @PayCheck
    public Resp<ClosePayOrderExtRS> closeOrder(@RequestBody @Validated(value = PaySignGroup.class) ClosePayOrderRQ rq) {
        return closeOrderProcess.closeOrder(rq);
    }
}
